<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script type="text/javascript" src="http://web.mcooz.com/js/jquery-1.11.1.min.js"></script>   
        <script type="text/javascript" charset="UTF-8" src="http://web.mcooz.com/js_source/artdialog/artDialog.source.js.js"></script>
        <script type="text/javascript" charset="UTF-8" src="http://web.mcooz.com/js_source/artdialog/plugins/iframeTools.source.js"></script>
        <link rel="stylesheet" type="text/css" href="http://web.mcooz.com/js_source/artdialog/skins/idialog.css" />
        
        <link rel="stylesheet" href="__PUBLIC__/assets/css/ace.min.css" />
        <link rel="stylesheet" href="__PUBLIC__/assets/css/ace-rtl.min.css" />
        <link rel="stylesheet" href="__PUBLIC__/assets/css/ace-skins.min.css" />
        <link href="__PUBLIC__/assets/css/bootstrap.min.css" rel="stylesheet" />
        <style>
.form-group {
  height: 51px;
}            
        </style>
            
        
    </head>

    <body style="width:300px;height:400px">
        <div class="row">
            <div class="col-xs-12">


                    <input name="act" value="edit" type="hidden">





                    <div class="space-4"></div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 等级 </label>

                        <div class="col-sm-9">
                            <input id="grade_level" name="grade_level" placeholder="" class="col-xs-10 col-sm-5" type="text">
                        </div>
                    </div>







                    <div class="space-4"></div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 所需贡献值 </label>

                        <div class="col-sm-9">
                            <input id="need_score" name="need_score" placeholder="" class="col-xs-10 col-sm-5" type="text">
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 等级名称 </label>

                        <div class="col-sm-9">
                            <input id="grade_name" name="grade_name" placeholder="" class="col-xs-10 col-sm-5" type="text">
                        </div>
                    </div>


                    <div class="space-4"></div>




                    <div class="clearfix form-actions">
                        <div class="col-md-offset-3 col-md-9">
                            <button class="btn btn-info" type="button" id="submit">
                                <i class="icon-ok bigger-110" ></i>
                                确定
                            </button>

                        </div>
                    </div>





                    <div class="space-24"></div>








                <script>
                $('#submit').on('click',function() {
                    id = art.dialog.data('id');
                     var grade_level = $("#grade_level").val();
                    var need_score = $("#need_score").val();
                    var grade_name = $("#grade_name").val();
                    if(id==0){
                        
                    var url = '<{:U('Admin/update_grade_act')}>';
                    $.getJSON(url, {'act':'add','grade_level': grade_level,'need_score': need_score,'grade_name': grade_name}, function (json)
                    {
                        if(json.status==1){
                        art.dialog.close();
                        return false;
                        }
                         alert(json.message)
                        art.dialog.close();

                    });
                    
                    
                        
                        
                        return false; 
                    }
                    var url = '<{:U('Admin/update_grade_act')}>';
                    $.getJSON(url, {'act':'update','id': id,'grade_level': grade_level,'need_score': need_score,'grade_name': grade_name}, function (json)
                    {
                        if(json.status==1){
                        var origin = artDialog.open.origin;
                        var grade_level_td = origin.document.getElementById('grade_level_'+id);
                        var need_score_td = origin.document.getElementById('need_score_'+id);
                        var grade_name_td = origin.document.getElementById('grade_name_'+id);
                        grade_level_td.innerHTML = grade_level;
                        need_score_td.innerHTML = need_score;
                        grade_name_td.innerHTML = grade_name;
                        art.dialog.close();
                        return false;
                        }
                         alert(json.message)
                        art.dialog.close();

                    });
                  
                       });
                </script>


            </div>
        </div>
    </body>
</html>
